const {createProxyMiddleware} = require('http-proxy-middleware');

module.exports = function(app) {
    app.use(
    '/api',
    createProxyMiddleware({
        target: 'http://chuko-blog.club:8888',
        changeOrigin: true,
        pathRewrite: { // 解决代理之后接口多出了/api，使用该设置成空路径，就能正常跨域使用了，解决400
            '^/api': '',
        }
    }));
};